package com.heo.service.impl;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.annotation.Resource;
import org.springframework.stereotype.Service;
import com.heo.dao.BaseMapper;
import com.heo.dao.StatusDictMapper;
import com.heo.pojo.StatusDictEntity;
import com.heo.service.StatusDictService;

@Service("statusDictService")
public class StatusDictServiceImpl extends BaseServiceImpl<StatusDictEntity> implements StatusDictService {
	@Resource
	private StatusDictMapper statusDictMapper;

	@Override
	protected BaseMapper<StatusDictEntity> getDao() {
		return statusDictMapper;
	}

	@Override
	public Map<String, StatusDictEntity> getStatusDictMap(Integer deviceModelId) {
		List<StatusDictEntity> statusDictList = getDao().listByKey(deviceModelId, "getByModelId");
		Map<String, StatusDictEntity> statusDictMap = new HashMap<String, StatusDictEntity>();
		for(StatusDictEntity statusDict : statusDictList) {
			statusDictMap.put(statusDict.getStatusCode(), statusDict);
		}
		return statusDictMap;
	}

}
